<template>
  <div class="checkDialog">
    <el-dialog title="题目审核" :visible="isCheckDialog" @close="addCancel">
      <div>
        <el-radio v-model="radio" label="1">通过</el-radio>
        <el-radio v-model="radio" label="2">拒绝</el-radio>
      </div>
      <el-input
        v-model="textarea"
        type="textarea"
        :rows="2"
        placeholder="请输入内容"
      />
      <el-row type="flex" justify="center" align="center">
        <el-button @click="addCancel">取消</el-button>
        <el-button type="primary" @click="testingCheck">确定</el-button>
      </el-row>
    </el-dialog>
  </div>
</template>

<script>
import { testingCheckAPI } from '@/api'
export default {
	name: 'CheckDialog',
	props: {
		isCheckDialog: Boolean,
		checkRowList: {
			type: Object,
			default: () => {}
		}
	},
	data() {
    return {
      radio: '1',
			textarea: ''
    };
	},
	methods: {
		// 点击确定按钮更改审核状态
		async testingCheck() {
			this.radio === '1' ? this.radio = 1 : this.radio = 2
			await testingCheckAPI(this.checkRowList.id, {
				id: this.checkRowList.id,
				chkState: this.radio,
				chkRemarks: this.textarea
			})
			this.$emit('update:isCheckDialog', false)
			this.$parent.getSelectedList();
		},
		// 点击取消按钮，关闭弹出层
		addCancel() {
			this.radio = '1'
			this.textarea = ''
			this.$emit('update:isCheckDialog', false)
		}
	}
}
</script>

<style scoped>
::v-deep .el-dialog{
	border-radius: 15px;
}
::v-deep .el-dialog__header{
	background-color:#409eff;
	border-radius: 15px 15px 0 0;

}
::v-deep .el-dialog__title{
	color:#fff;
}
::v-deep .el-dialog__close{
	color:#fff
}
::v-deep .el-dialog{
	width: 500px;
}
::v-deep .el-textarea{
	margin: 30px 0 50px;
}
</style>